xen/sched: fix cpu hotplug
authorJuergen Gross <jgross@suse.com>
Tue, 11 Oct 2022 13:00:19 +0000 (15:00 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 11 Oct 2022 13:00:19 +0000 (15:00 +0200)
commit4f3204c2bc66db18c61600dd3e08bf1fd9584a1b
tree7a154f96c9591673707733d44b5ebfc1b405c114
parentc377ceab0a007690a1e71c81a5232613c99e944d
xen/sched: fix cpu hotplug

Cpu unplugging is calling schedule_cpu_rm() via stop_machine_run() with
interrupts disabled, thus any memory allocation or freeing must be
avoided.

Since commit 5047cd1d5dea ("xen/common: Use enhanced
ASSERT_ALLOC_CONTEXT in xmalloc()") this restriction is being enforced
via an assertion, which will now fail.

Fix this by allocating needed memory before entering stop_machine_run()
and freeing any memory only after having finished stop_machine_run().

Fixes: 1ec410112cdd ("xen/sched: support differing granularity in schedule_cpu_[add/rm]()")
Reported-by: Gao Ruifeng <ruifeng.gao@intel.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
Tested-by: Andrew Cooper <andrew.cooper3@citrix.com>
master commit: d84473689611eed32fd90b27e614f28af767fa3f
master date: 2022-09-05 11:42:30 +0100
xen/common/sched/core.c
xen/common/sched/cpupool.c
xen/common/sched/private.h